package ioc13;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class SomeBean implements ApplicationContextAware, BeanFactoryAware, BeanNameAware {

    private ApplicationContext ac;

    private String beanName;

    public void doSome(){
        System.out.println("SomeBean.doSome()");

        System.out.println("doSome ac = " + ac);

        System.out.println("beanName = " + beanName);
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {

    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("SomeBean.setApplicationContext()");
        ac=applicationContext;
    }

    @Override
    public void setBeanName(String name) {
        beanName=name;
    }
}
